# Api中间件层, 所以关于Api的请求都必须经过此中间件
from django.utils.deprecation import MiddlewareMixin
from django.conf import settings
from BloodSpiderWeb.views import urls as web_urls

class PathManage(MiddlewareMixin):
    def process_request(self, request):
        request.set_info_js_path = f"{request.scheme}://{request.get_host()}/static/js/login.js"
        if request.path.startswith('/web/pc/'):
            request.web_urls = web_urls.urlpatterns
            request.login_url = settings.LOGIN_URL
            request.project_name = settings.PROJECT_NAME
        return None
    def process_response(self, request, response):

        return response



